package kr.or.smardi.smardi_AScan.Help;

import kr.or.smardi.smardi_AScan.*;
import kr.or.smardi.smardi_AScan.Scan.*;
import kr.or.smardi.smardi_AScan.User.*;
import android.app.*;
import android.content.*;
import android.os.*;
import android.view.*;
import android.widget.*;

public class AC_Help_tip extends Activity {

	RelativeLayout titleBar = null;
	ImageButton btn_TopLeft = null;
	ImageButton btn_TopRight = null;
	TextView txt_subTitle = null;

	// 탭 메뉴
	LinearLayout tabMenu = null;
	ImageButton tab_measure = null;
	ImageButton tab_record = null;
	ImageButton tab_user = null;
	ImageButton tab_help = null;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ac_help_tip);
		
		titleBar = (RelativeLayout) findViewById(R.id.inc_title_bar);
		btn_TopLeft = (ImageButton) titleBar.findViewById(R.id.btn_top_left);
		btn_TopLeft.setImageDrawable(getResources().getDrawable(
				R.drawable.c_btn_back));
		btn_TopLeft.setOnClickListener(onClickListener);
		btn_TopRight = (ImageButton) titleBar.findViewById(R.id.btn_top_right);
		btn_TopRight.setVisibility(View.GONE);
		txt_subTitle = (TextView) findViewById(R.id.txt_subTitle);
		txt_subTitle.setText(getString(R.string.subTitle_help_tip));

		// 탭 세팅--------------------------
		tabMenu = (LinearLayout) findViewById(R.id.inc_tab_menu);
		tab_measure = (ImageButton) findViewById(R.id.tab_measure);
		tab_record = (ImageButton) findViewById(R.id.tab_record);
		tab_user = (ImageButton) findViewById(R.id.tab_user);
		tab_help = (ImageButton) findViewById(R.id.tab_help);
		tab_help.setImageDrawable(getResources().getDrawable(
				R.drawable.tab_help_1));

		tab_record.setOnClickListener(onClickListener);
		tab_user.setOnClickListener(onClickListener);
		tab_measure.setOnClickListener(onClickListener);
		// 탭 세팅 끝--------------------------
	}
	
	
	View.OnClickListener onClickListener = new View.OnClickListener() {		
		@Override
		public void onClick(View v) {
			switch(v.getId()) {
			case R.id.tab_measure:
				gotoMeasure();
				break;
			case R.id.tab_record:
				gotoRecord();
				break;
			case R.id.tab_user:
				gotoUser();
				break;
			case R.id.btn_top_left:
				gotoHelp();
				break;
			}
		}
	};
	
	
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {

		switch (keyCode) {
		case KeyEvent.KEYCODE_BACK:

			gotoHelp();
			return false;
		}

		return super.onKeyDown(keyCode, event);
	}
	
	
	private void gotoMeasure() {
		Intent intent = new Intent(AC_Help_tip.this, AC_Scan_main.class);
		startActivity(intent);
		finish();
		overridePendingTransition(R.anim.fadein, R.anim.fadeout);
	}
	
	private void gotoRecord() {
		/*Intent intent = new Intent(AC_Help_tip.this, AC_Scan_main.class);
		startActivity(intent);
		finish();
		overridePendingTransition(R.anim.fadein, R.anim.fadeout);*/
	}
	
	private void gotoUser() {
		Intent intent = new Intent(AC_Help_tip.this, AC_UserMain.class);
		startActivity(intent);
		finish();
		overridePendingTransition(R.anim.fadein, R.anim.fadeout);
	}
	
	private void gotoHelp() {
		Intent intent = new Intent(AC_Help_tip.this, AC_Help_main.class);
		startActivity(intent);
		finish();
		overridePendingTransition(R.anim.fadein, R.anim.fadeout);
	}
}
